<template>
    <div :class="opt.shadow?'shadow ethan-header bt-1px':'ethan-header bt-1px'">
        <div class="header-left" v-if="needBack" @click.prevent="goBack">
            <md-icon name="arrow-left" size="lg" color="#4d96f3"></md-icon>
            <span>返回</span>
        </div>
        <div class="header-title">{{title}}</div>
        <div class="header-right" v-if="opt.showMenu">
            <md-icon name="edit" size="lg" color="#4d96f3"></md-icon>
        </div>
    </div>
</template>

<script lang="ts">
import { Vue, Component } from "vue-property-decorator";
@Component({
    props:['opt','title', 'needBack']
})
export default class EHeader extends Vue {
    goBack(){
        this.$router.go(-1)
    }
}
</script>

<style scoped lang="scss">
.ethan-header{
    height: 44PX;
    width: 100vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14PX;
    border-bottom: 1px solid #eee;
    position: fixed;
    top: 0;
    left: 0;
    &.shadow{
        box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
    }
    .header-left{
        width: 60PX;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        z-index: 3;
        span{
            color: #4d96f3;
        }
    }
    .header-title{
        width: 100vw;
        height: 44PX;
        position: absolute;
        left: 0;
        top: 0;
        line-height: 44PX;
        text-align: center;
        z-index: 2;
    }
    .header-right{
        width: 60PX;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        z-index: 3;
    }
}

</style>